<template>
  <div class="main_div">
    <!--左边 background-color: #667fdd-->
    <div id="leftDiv" style="">
      <div class="leftDiv_top">
        <div>
          <img class="bigImg" :src=user.avatar  @click="logout">
          <p class="username" :style="search2">{{user.realname}}</p>
        </div>
        <!--当前用户信息及搜索框-->
        <div style="margin-bottom: 8px">
          <a-input-search placeholder="搜索" class="searchButton2"  v-model="queryParam.query_title" :style="search3"
                          @search="queryPageListByTitle"/>
          <!--<a-button :style="search2" class="searchButton" @click="queryPageListByTitle" title="搜索" type="link">
            <a-icon type="search"/>
          </a-button>-->
        </div>
      </div>
      <div class="leftDiv_foot">
        <a-tabs default-active-key="1" class="leftDiv_foot_tabs" @change="topicChange">
          <a-tab-pane key="1" tab="常规">
            <div class="leftDiv_body">
              <div class="leftDiv_smart_list">
                <!--智能清单-->
                <SmartList :neLableList="this.neLableList"
                           :queryParam="this.queryParam"
                           :note="this.note"
                           @queryPageListBySmart="queryPageListBySmart"
                           ref="SmartList"></SmartList>
                <!--笔记类型-->
                <div>
                  <a-checkbox-group @change="queryPageListByType">
                    <a-checkbox value="1">
                      笔记
                    </a-checkbox>
                    <a-checkbox value="2">
                      任务
                    </a-checkbox>
                  </a-checkbox-group>
                </div>
              </div>
              <div class="leftDiv_lable">
                <!--标签区域-->
                <a-modal width="200px"
                         :visible="visible3"
                         centered
                         @cancel="editLable.nl_name=editOldNlName;visible3=false"
                         @ok="saveLable"
                         style="text-align: center;">
                  <br>
                  <h4 style="position: absolute;margin-top: 4px;margin-left: 65px;">名称：</h4>
                  <a-input style="margin-bottom:10px;width: 100%" v-model="editLable.nl_name" placeholder="请输入"/>
                </a-modal>

                <div>
                  <a-tabs default-active-key="1" @change="lableChange">
                    <a-tab-pane key="1" tab="标签树">
                      <a-icon type="plus" style="float: right;padding-right: 8px" @click="openLableEdit"  />
                      <a-tree :load-data="onLoadData"
                              :replaceFields="{children:'children', title:'nl_name', key:'nlt_id' }"
                              @select="queryPageListByLableTreeId"
                              :tree-data="noteLableTreeListData" >
                        <template slot="nl_name" slot-scope="item">
                          <span v-show="!item.isEdit">{{item.nl_name}} </span>
                          <a-input size="small" v-show="item.isEdit" v-model="item.nl_name" style="width: 100px;"/>
                          <a-button-group style="float:right">
                            <a @click.stop="showLableTreeEdit(item)" v-show="!item.isEdit" style="float: right;margin-left: 10px;color: #00A0E9">
                              <a-tooltip type="tmpStyle" class="menu-item" title="添加">
                                <a-icon type="plus"/>
                              </a-tooltip>
                            </a>

                            <LableList :note="note"
                                       :defaultValue="netLableTreeTags"
                                       :defaultValueKey="'nl_id'"
                                       :obj="netLableTreeEdit"
                                       @change="saveLableTree"
                                       ref="LableList"/>

                            <a style="float: right;margin-left: 10px;color: #00A0E9" @click.stop="deleteLabelTreeById(item)">
                              <a-tooltip type="tmpStyle" class="menu-item" title="删除">
                                <a-icon type="minus-circle-o"/>
                              </a-tooltip>
                            </a>
                          </a-button-group>
                        </template>
                      </a-tree>
                    </a-tab-pane>
                    <a-tab-pane style="height: 100%;overflow-y: auto" key="2" tab="标签池" force-render >
                      <a-icon type="plus" style="float: right;padding-right: 8px" @click="openLableEdit"  />

                      <a-list size="small" style="width:230px;height:400px;overflow-x:auto" item-layout="horizontal" :data-source="neLableList">
                        <a-list-item slot="renderItem" slot-scope="item, index" @click="queryPageListByLableId(item)" v-bind:class="{list_select:queryParam.nl_ids==item.nl_id?true:false}" style="cursor:pointer">
                          <a-list-item-meta>
                            <div slot="title">
                              {{item.nl_name}}
                              <a  style="float: right;margin-right: 10px;color: #00A0E9"
                                  @click.stop="openLableEdit(item)">
                                <a-tooltip type="tmpStyle" class="menu-item" title="修改">
                                  <a-icon type="edit"/>
                                </a-tooltip>
                              </a>

                            </div>
                          </a-list-item-meta>
                        </a-list-item>
                      </a-list>
                    </a-tab-pane>
                  </a-tabs>
                </div>
              </div>
            </div>
          </a-tab-pane>
          <a-tab-pane key="2" tab="主题" force-render>
            <a-tree :load-data="onLoadData_topic"
                    :replaceFields="{children:'children', title:'nn_title', key:'nt_id' }"
                    @select=" (key,e)=>{this.findNoteByCode(e.node.dataRef.nn_code);}"
                    :tree-data="noteTopicTreeListData" />
          </a-tab-pane>
        </a-tabs>
      </div>
    </div>
    <!--中间-->
    <div id="centreDiv" v-show="!this.topicShow">
      <div class="centreDiv_top">
        <h2>{{this.queryTip.tip?this.queryTip.tip:"所有的工作清单"}}</h2>
        <a-input @keyup.enter="insert(false)" v-model="insertValue" :placeholder="this.queryTip.tip2?this.queryTip.tip2:'回车可快速建立新建云记'"/>
      </div>
      <div class="centreDiv_foot">
        <!--笔记列表-->
        <a-list id="noteListData_List" item-layout="horizontal" :data-source="noteListData" :loading="noteListDataLoading">
          <div    v-if="noteListDatapagination.pageNumber<noteListDatapagination.totalPage"
                  slot="loadMore"
                  :style="{ textAlign: 'center', marginTop: '12px', height: '32px', lineHeight: '32px' }">
            <a-button v-if="noteListDatapagination.pageNumber<noteListDatapagination.totalPage" @click="queryPageListNext">
              更多
            </a-button>
          </div>

          <a-list-item slot="renderItem" @click="findNoteByCode(item.nn_code)" v-bind:class="{list_select:item.nn_id==note.nn_id?true:false}" :id="'note_li_'+item.nn_id" slot-scope="item, index">
            <a-list-item-meta>
              <a slot="title" >{{item.nn_title}}</a>
            </a-list-item-meta>
          </a-list-item>
        </a-list>
      </div>
    </div>
    <!--右边-->
    <editor  ref="editor"
             @findNote="findNote"
             @queryPageRefresh="queryPageRefresh"
             @updateListNote="updateListNote"/>
  </div>
</template>

<script>
  import { postAction  } from '@/api/dl'
  import editor from "./editor";
  import LableList from "@/components/LableList";

  import SmartList from "../../components/smartlist/SmartList";
  import Vue from 'vue'//获取token
  export default {
    components: {
      SmartList,
      editor,
      LableList
    },
    name: "index",
    data() {
      return {
        visible3:false,
        editLable:{},//当前编辑中的标签池
        editOldNlName:{},//旧标签名称
        note:{},//当前编辑的云记对象
        noteLableTreeListData:[],//标签树
        noteLableTreeMapData:new Map(),//标签树map对象，key是nltid
        netLableTreeTags:[],//当前标签树节点
        netLableTreeEdit:{},//当前编辑的标签树节点对象
        noteTopicTreeListData:[],//主题树
        neLableList: null ,//标签池（list)
        noteListData: [],//笔记列表
        noteListDataLoading:false,//笔记是否加载中
        noteListDatapagination:{//笔记分页情况
          pageNumber:1,
          pageSize:10,
          totalPage:0,
          totalRow:0,
        },
        //上一次查询条件
        queryParam: {
          nl_ids:null,//标签ids
          nl_ids_names:null,
          tree_id:null,//标签树父id
          tree_id_name:null,
          nsl_id:null, //智能清单
          nsl_id_name:null,
          nn_type:null,//笔记类型
          nn_type_name:null,
          query_title:null,//模糊搜索条件
        },
        queryTip:{
          t1:null,//查询类型  智能清单、标签树、标签池
          t2:null,//任务或笔记
          tip:null,//提示
          tip2:null//快速插入
        },//查询提示
        topicShow:false,//是否显示主题
        insertValue: null,//快速创建的value
        //中间table是否展开所有子节点
        tableLoading: true,
        //中间分页
        tempPage: {},
        //分页触发的查询（因为分页查询不需要设置第一页，其余都需要）
        paginationFlag: false,
        //中间table的分页
        pagination: {
          current: 1,//默认第一页
          pageSize: 10,//每页中显示5条数据
          total: 0,//有几条
          sloadDataizeChanger: true,
          pageSizeOptions: ["10", "20"],//每页中显示的数据
          showTotal: total => `共有 ${this.tempPage.total} 条数据`,  //分页中显示总的数据
        },
        leftExpandedKeys2: [],
        leftExpandedKeys: [],
        //添加智能表单中的标签树的ID
        checkedKeys: [],
        leftAutoExpandParent2: true,
        leftAutoExpandParent: true,
        //用于存放标签树的值
        leftmas: [],
        //用于标签树移动的保存值
        dropKey2: [],
        //用于隐藏搜索按钮
        search2: '',
        //用于隐藏搜索输入框
        search3: 'display:',
        //用于搜索的值
        searchVar: '',
        //用户信息
        user: {}
      }
    },
    watch: {
    },
    methods: {
      /**
       * 退出登录
       */
      logout(){
        let that = this;
        this.$confirm({
          title: '提示',
          content: '真的要注销登录吗 ?',
          onOk() {
            postAction("noteUser/logout").then(res=>{
              if(res.code=="200"||res.code=="0"){
                window.location.href = "/note/login";

                this.$message.success('欢迎回来')
                Vue.ls.remove("ACCESS_TOKEN");
                Vue.ls.remove("USER_INFO");

                window.location.href = "/note/login";
              }else{
                this.$message.error(res.tip);
              }
            }).catch(error=>{

            })
          },
          onCancel() {
          }
        })
      },
      openLableEdit(item){
        this.editOldNlName=item.nl_name;
        this.visible3=true;
        if(item){
          this.editLable=item;
        }else{
          this.editLable={nl_name:""};
        }
      },
      saveLable(){
        let isNew=this.editLable.nl_id?false:true;
        postAction('nelable/saveOrUpdate',{
          nl_id:this.editLable.nl_id,
          nl_name:this.editLable.nl_name
        }).then((res)=>{
          if(!res.is){
            this.$message.error(res.tip);
            this.editLable.nl_name=this.editOldNlName;
          }else{
            if(isNew)this.queryLable();//新建则刷新列表
            this.visible3=false;
          }
        })
      },
      showLableTreeEdit(o){
        this.netLableTreeEdit=o;
        this.findLableTreeByNlUid(o.nl_id);
        this.$refs.LableList.load();
      },
      //标签树操作开始
      dataDriveModify(o) {
        // o.nl_name = Math.random();
        // o.dataRef.nl_name = Math.random();

        o.isEdit=false;
        o.dataRef.isEdit=false;
        console.log(o);
      },
      /**
       * 保存当前页面已选中标签到标签树
       */
      saveLableTree(ids){
        let that=this;
        postAction('nelable/saveOrUpdateLableTree',{
          son_nlIds:ids.join(','),
          nlUId:this.netLableTreeEdit.nl_id,
          nlt_u_id:this.netLableTreeEdit.nlt_id
        }).then((res) => {
          this.netLableTreeEdit.nlt_is_leaf=res.data.nlt_is_leaf;
          this.netLableTreeEdit.dataRef.nlt_is_leaf=res.data.nlt_is_leaf;
          this.onLoadData(this.netLableTreeEdit);
        })
      },

      //标签树操作结束

      //分页选择查询 &#45;&#45; 几条数据和第几页查询
      handleTableChange(pagination) {
        this.pagination.current = pagination.current;
        this.pagination.pageSize = pagination.pageSize;
        console.log("pagination", this.pagination);
        this.queryParam.page = pagination.current;
        this.queryParam.size = pagination.pageSize;
        this.paginationFlag = true;
        this.queryTableNote();
      },
      initQueryParam() {
        if (this.paginationFlag == false) {
          this.queryParam.page = 1;
          this.queryParam.size = 10;
        }
        this.paginationFlag = false;
      },
      //查询中间table树形日记
      queryTableNote(newCreate) {
        if (this.queryParam.default == 0) {
          this.querySmart(0,newCreate);//标签树
        } else if (this.queryParam.default == 1) {
          this.selectNotClass(0,newCreate);//未分类
        }
      },
      //查询中间表，条件不改变
      queryCenterNote(flag){
        this.paginationFlag = true;
        this.queryTableNote(flag!=undefined?flag:1);
      },
      /**
       * 根据code查询云记
       */
      findNoteByCode(nn_code) {
        this.$refs.editor.findNoteByCode(nn_code);
      },
      /**
       * 云记更新后同步更新云记列表上的note
       */
      updateListNote(note){
        if(!note||!note.nn_id)return ;
        this.noteListData.forEach(function (o) {
          if(o.nn_id==note.nn_id){
            o.nn_title=note.nn_title;
          }
        });
      },
      /**
       * 点击云记时设置当前云记对象
       */
      findNote(note){
        if(!note||!note.nn_id)return ;
        this.note=note;
      },

      //隐藏搜索框
      lik() {
        if (!this.queryParam.query_title) {
          this.search3 = 'display:none'
          this.search2 = ''
        }
      },
      //显示搜索框
      search(k) {
        this.search2 = 'display:none'
        this.search3 = ''
      },
      //删除中间树子集为空的树形
      objFieldDelete(obj) {
        if (obj) {
          for (let i = 0; i < obj.length; i++) {
            if (obj[i].childList.length > 0) {
              this.objFieldDelete(obj[i].childList)
            } else {
              delete obj[i].childList;
            }
          }
        }
      },
      //得到中间树结果后赋值
      selectResult(res,newCreate) {
        console.log("selectResult", res);
        this.tableLoading = true;
        setTimeout(() => {
          this.data = res.result.records
          this.objFieldDelete(this.data);
          this.tableLoading = false;
          this.tempPage = res.result;
          this.pagination.total = this.tempPage.total;
          //不是新建渲染数据时，需要打开第一个笔记
          if (newCreate!=1&&this.data.length > 0) {
            this.$refs.rightEditor.queryNoteById(this.data[0].nnId);
          }
        }, 100)

      },

      /**
       * 删除标签书
       */
      deleteLabelTreeById(o){
        let self = this
        this.$confirm({
          title: '确认提示',
          content: `该操作会将所有的子关系删除，您确定吗？`,
          okType: 'danger',
          onOk () {
            postAction('nelable/deleteLabelTreeById',{
              nlt_id:o.nlt_id
            }).then((res) => {
              if(this.noteLableTreeMapData.get(this.netLableTreeEdit.nlt_u_id)){//存在父对象
                self.onLoadData(this.noteLableTreeMapData.get(this.netLableTreeEdit.nlt_u_id));
              }else{
                // this.noteLableTreeMapData.delete(o);
                // delete this.noteLableTreeListData
              }
            })
          }
        });



      },

      selectId(nlId) {
        this.queryParam.nlId = nlId;
        this.querySmart(1);
      },
      //查找未分类的数据
      selectNotClass(status,newCreate) {
        this.queryParam.nlId = 0;//标签id
        this.queryParam.nslId = 0;//智能表id

        if(status==1){
          this.pagination.current = 1;
          this.queryParam.page = 1;

          if (this.queryParam.default != 1) {
            this.queryParam.default = 1;
            this.queryNotLable(newCreate);
          } else {
            this.querySmart(status,newCreate);
          }
        }else{
          this.queryNotLable(newCreate);
        }
      },
      //未分类查询的请求
      queryNotLable(newCreate) {
        this.initQueryParam();
        this.queryParam.selectedKeys = [];
        postAction(`note/selectNotClass/${this.queryParam.page}/${this.queryParam.size}?value=${this.queryParam.value}`).then((res) => {
          this.selectResult(res,newCreate);
        })
      },

      /**
       * 主题与常规的切换
       */
      topicChange(key){
        if(key==2){//切换到主题
          if(this.noteTopicTreeListData.length>0){
            this.findNoteByCode(this.noteTopicTreeListData[0].nn_code);
          }else{
            this.note={};
          }
          this.topicShow=true
        }else{//切换到常规
          this.topicShow=false
          if(this.noteListData.length>0){
            this.findNoteByCode(this.noteListData[0].nn_code);
          }else{
            this.note={};
          }
        };
      },
      /**
       * 标签树与标签池的切换
       */
      lableChange(key){
        if(key==2){//标签池
          this.queryLable();
        }
      },
      queryLableTree(){
        let that=this;
        this.loadLableTree({},function (res) {
          if(res.data){
            res.data.forEach(function (o) {
              o.scopedSlots= {title:"nl_name"};
            });
            that.noteLableTreeListData= res.data;
            that.setMap(res.data);
          }
        });
      },

      setMap(list){
        if(list){
          let that=this;
          list.forEach(function (o) {
            that.noteLableTreeMapData.set(o.nlt_id,o);
          });
        }

      },

      /**
       * 根据标签查询所有的子标签树
       */
      findLableTreeByNlUid(id){
        let that=this;
        this.loadLableTree({ nl_id:id,},function (res) {
          that.netLableTreeTags=res.data;
        });
      },
      loadLableTree(param,fn){
        postAction('nelable/queryLableTree',param).then((res) => {
          if(fn)fn(res);
        })
      },
      /**
       * 异步加载标签树
       */
      onLoadData(treeNode){
        let that=this;
        this.loadLableTree({
          nl_id:treeNode.dataRef.nl_id,
          nlt_id:treeNode.dataRef.nlt_id
        },function (res) {
          // console.log(res.data);
          if(res.data){
            res.data.forEach(function (o) {
              o.scopedSlots= {title:"nl_name"};
            });

            that.netLableTreeTags=res.data;
            treeNode.dataRef.children= res.data;
            that.noteLableTreeListData = [...that.noteLableTreeListData];
            that.setMap(res.data);
          }else{
            treeNode.dataRef.children=[];
            that.netLableTreeTags=[];
          }
        });
      },
      /**
       * 异步加载主题树
       */
      onLoadData_topic(treeNode){
        postAction('note/queryTopicTree',{"nt_id":treeNode.dataRef.nt_id}).then((res) => {
          treeNode.dataRef.children= res.data;
          this.noteTopicTreeListData = [...this.noteTopicTreeListData];
        })
      },
      /**
       * 查询提示语
       */
      setQueryTip(){
        let nn_type= this.queryParam.nn_type;
        if(nn_type && !(nn_type.indexOf("1")!=-1&&nn_type.indexOf("2")!=-1)){
          if(nn_type.indexOf("1")!=-1) {
            this.queryTip.t2="笔记";
          }else{
            this.queryTip.t2="任务";
          }
        }else{
          this.queryTip.t2=null;
        }

        if(this.queryParam.nl_ids){//标签
          for (var i in this.neLableList){
            if(this.neLableList[i].nl_id==this.queryParam.nl_ids){
              this.queryTip.t1="标签'"+this.neLableList[i].nl_name+"'";
              break;
            }
          }
        }else if(this.queryParam.nsl_id){//智能清单
          for (var i in this.leftUpData){
            if(this.leftUpData[i].nslId==this.queryParam.nsl_id){
              this.queryTip.t1="智能清单'"+this.leftUpData[i].nslName+"'";
              break;
            }
          }
        }else if(this.queryParam.tree_id){//标签树
          for (var i in this.noteLableTreeListData){
            if(this.noteLableTreeListData[i].nlt_id==this.queryParam.tree_id){
              this.queryTip.t1="标签树'"+this.noteLableTreeListData[i].nl_name+"'";
              break;
            }
          }
        }else{
          this.queryTip.t1=null;
        }

        if(this.queryTip.t1||this.queryTip.t1){
          if(this.queryTip.t1){
            this.queryTip.tip=this.queryTip.t1;
            this.queryTip.tip2=this.queryTip.t1;
          }

          if(this.queryTip.t2){
            this.queryTip.tip+="类型为'"+this.queryTip.t2+"'";
            this.queryTip.tip2+="类型为'"+this.queryTip.t2+"'";
          }

          if(this.queryTip.tip)this.queryTip.tip+="的云记";
          if(this.queryTip.tip2)this.queryTip.tip2="回车可快速新建"+this.queryTip.tip2;
        }else{
          this.queryTip.tip=null;
        }
      },

      /**
       * 模糊搜索
       */
      queryPageListByTitle() {
        this.queryParam.pageNumber=1;
        this.queryPageList(this.queryParam);
       /* postAction("/nelable/search?" + "name=" + this.searchVar).then((res) => {
          this.leftmas = res.result
          this.appendEdit(this.leftmas);
        })*/
      },

      /**
       * 根据笔记类型查询（任务还是笔记）
       */
      queryPageListByType(checkedValues) {
        var value = checkedValues.join(',');
        this.queryParam.nn_type = value;
        this.queryParam.pageNumber=1;
        this.queryPageList(this.queryParam);
      },
      /**
       * 根据智能清单查询笔记
       */
      queryPageListBySmart(nsl_id){
        let nn_type=this.queryParam.nn_type;
        let query_title=this.queryParam.query_title;
        this.queryParam={};
        this.queryParam.nsl_id=nsl_id;
        this.queryParam.nn_type=nn_type;
        this.queryParam.pageNumber=1;
        this.queryParam.query_title=query_title;

        this.queryPageList(this.queryParam);
      },
      /**
       * 根据标签树查询云记
       */
      queryPageListByLableTreeId(key,e){
        let record = e.node.dataRef
        let nn_type=this.queryParam.nn_type;
        let query_title=this.queryParam.query_title;
        this.queryParam={};
        this.queryParam.tree_id=record.nlt_id;
        this.queryParam.nn_type=nn_type;
        this.queryParam.pageNumber=1;
        this.queryParam.query_title=query_title;

        this.queryPageList(this.queryParam);
      },
      /**
       * 根据标签查询云记
       */
      queryPageListByLableId(o){
        let nn_type=this.queryParam.nn_type;
        let query_title=this.queryParam.query_title;
        this.queryParam={};
        this.queryParam.nl_ids=o.nl_id;
        this.queryParam.nn_type=nn_type;
        this.queryParam.pageNumber=1;
        this.queryParam.query_title=query_title;
        this.queryPageList(this.queryParam);


      },
      /**
       * 加载智能清单
       */
      querySmartLable() {
        // console.log("querySmartLable");
        let that=this;
        this.$nextTick(()=>{
          that.$refs.SmartList.querySmartLable();
        });
      },

      /**
       * 下一页
       */
      queryPageListNext(){
        this.noteListDatapagination.pageNumber+=1;
        this.queryParam.pageNumber=this.noteListDatapagination.pageNumber;
        // console.log(this.noteListDatapagination.pageNumber,this.queryParam.pageNumber);
        this.queryPageList(this.queryParam);
      },

      /**
       * 云集列表刷新
       */
      queryPageRefresh(){
        this.queryParam.pageNumber=1;
        this.queryPageList(this.queryParam);
      },

      /**
       * 查询笔记列表（分页）
       * 总的查询逻辑方法
       */
      queryPageList(param){
        this.setQueryTip();
        let tath=this;
        postAction('note/pageList',param).then((res) => {
          if(tath.queryParam.pageNumber==1){//第一页
            this.noteListData = res.data.list;
          }else{
            this.noteListData = this.noteListData.concat(res.data.list);
          }

          this.noteListDatapagination=res.data;//当前查询页情况

          if(this.noteListData.length>0){//有云记列表
            this.findNoteByCode(res.data.list[0].nn_code);
          }else{//没有列表结果
            this.note={};
            this.$refs.editor.setNote(this.note);
          }
        })
      },

      queryLable() {
        //加载标签池列表
        postAction('nelable/querylist',{}).then((res) => {
          this.neLableList = res.data;
        })

      },

      //页面刷新加载数据
      /**
       * 初始化数据
       */
      loadData() {
        //获取头像
        postAction('nelable/getUser').then((res) => {
          // console.log("获取头像",res);
          this.user = res.result;
        })
        this.queryLable();//标签池
        this.queryLableTree();//标签树
        this.querySmartLable();//智能表
        this.queryPageList();//查询默认笔记
        //加载主题树
        postAction('note/queryTopicTree').then((res) => {
          this.noteTopicTreeListData= res.data;
        })

        this.queryParam.page = 1;//第几页
        this.queryParamsize = 10;//每页中显示数据的条数
        this.pagination.current = 1;//默认第一页
        this.pagination.pageSize = 10;//每页中显示5条数据
      },
      //快速创建
      insert(flag) {
        if ((this.insertValue != null && this.insertValue.length > 0) || flag) {
          let note= {};
          note.nnTitle=this.insertValue;
          //云记类型
          let nn_type=this.queryParam.nn_type;
          if(!nn_type||nn_type.split(",").length>1){//不选或全选，则默认为笔记类型
            note.nn_type=1;
          }else{
            note.nn_type=nn_type;
          }
          note.nl_ids=this.queryParam.nl_ids;
          note.tree_id=this.queryParam.tree_id;
          note.nsl_id=this.queryParam.nsl_id;

          this.queryParam.pageNumber=1
          let queryParam=this.queryParam;
          postAction("note/saveOrUpdate", note).then(res => {
            if (res.is) {
              this.queryPageList(queryParam);
            } else {
              this.$message.error(`${res.message}！`);
            }
          }).catch(error => {
            this.$message.error(`保存失败！`);
          })
          this.insertValue = '';
        } else {
          this.$message.warning('快速创建需要输入内容');
        }
      },













      //标签树杈点击事件(展开/合并）
      onExpand(leftExpandedKeys) {
        console.log("onExpand")
        this.leftExpandedKeys = leftExpandedKeys;
        this.leftAutoExpandParent = false;
      },

      //点击树节点查询笔记事件
      onSelect(keys, event) {
        console.log("onSelect",keys,event)
        this.queryParam.selectedKeys = keys
        this.selectId(keys);
      },

    },
    mounted(){
    },
    created() {
      this.loadData();
    }
  }
</script>

<style scoped>
  /*
    .smartColor {
      font-weight: bold;
      color: #b3d4fc;
    }



    .searchButton {
      font-size: 20px;
      margin-top: 10px;
      float: right;
    }

    #components-layout-demo-basic .ant-layout-header,
    #components-layout-demo-basic .ant-layout-footer {
      background: #7dbcea;
      color: #fff;
    }

    #components-layout-demo-basic .ant-layout-footer {
      line-height: 1.5;
    }

    #components-layout-demo-basic .ant-layout-sider {
      background: #3ba0e9;
      color: #fff;
      line-height: 120px;
    }

    #components-layout-demo-basic .ant-layout-content {
      background: rgba(16, 142, 233, 1);
      color: #fff;
      min-height: 120px;
      line-height: 120px;
    }

    #components-layout-demo-basic > .ant-layout {
      margin-bottom: 48px;
    }

    #components-layout-demo-basic > .ant-layout:last-child {
      margin: 0;
    }*/

</style>